<template>
    <div id=push>
         <!---显示规格-->
      <el-table :data="tableData" style="width: 100%">
        <el-table-column
          prop="size"
          label="尺寸"
          width="180"
          :formatter="spsize"
        >
        </el-table-column>
        <el-table-column
          prop="color"
          label="颜色"
          width="180"
          :formatter="spcolor"
        >
        </el-table-column>
        <el-table-column prop="brand" label="品牌" :formatter="spbrand">
        </el-table-column>
      </el-table>
    </div>
</template>
<script>
export default {
  data() {
    return {
      tableData: [],
       proId: this.$route.params.id,
    };
  },
  created: function () {
      console.log(this.$route.params.id);
    this.axios
      .get("http://localhost:35043/api/Sepcification/GetSepcification?id="+this.$route.params.id)
      .then((res) => {
        this.tableData = res.data.data;
      });
      console.log(this.tableData);
  },
  methods: {
    spsize: function (row, column, cellValue) {
      if (cellValue == "13寸") {
        return "13寸";
      } else if (cellValue == "14寸") {
        return "14寸";
      } else if (cellValue == "15寸") {
        return "15寸";
      }
    },
    spcolor: function (row, column, cellValue) {
      if (cellValue == "白色") {
        return "白色";
      } else if (cellValue == "黑色") {
        return "黑色";
      } else if (cellValue == "红色") {
        return "红色";
      }
    },
    spbrand: function (row, column, cellValue) {
      if (cellValue == "联想") {
        return "联想";
      } else if (cellValue == "华为") {
        return "华为";
      } else if (cellValue == "苹果") {
        return "苹果";
      }
    },
  },
};
</script>